package com.atguigu.gulimall.feign.search;

import com.atguigu.gmall.common.result.Result;
import com.atguigu.gulimall.search.entity.Goods;
import com.atguigu.gulimall.search.vo.SearchParamVo;
import com.atguigu.gulimall.search.vo.SearchResponseVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * @author nicc
 * @version 1.0
 * @className SearchFeignClient
 * @date 2022-10-14 02:03
 */
@RequestMapping("/api/inner/search")
@FeignClient("service-search")
public interface SearchFeignClient {

    @PostMapping("/onsale")
    Result onSaleGoods(@RequestBody Goods goods);

    @DeleteMapping("/cancelSale/{skuId}")
    Result cancelSaleGoods(@PathVariable("skuId") Long skuId);

    /**
     * 检索商品
     * @param paramVo
     * @return
     */
    @PostMapping("/sku/search")
    Result<SearchResponseVo> search(@RequestBody SearchParamVo paramVo);

    /**
     * 更新热度分
     * @param skuId
     * @param hotScore
     * @return
     */
    @GetMapping("/hotscore/{skuId}")
    public Result updateHotScore(@PathVariable("skuId") Long skuId,
                                 @RequestParam("hotScore") Long hotScore);
}
